package com.dw.demo.consumer.controller;


import com.dw.demo.consumer.service.RestTemplateService;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class UserInfoController {

    @Autowired
    RestTemplateService helloService;

 /*   *//**
     * HystrixCommand  配置熔断返回方法
     * @return
     *//*
    @RequestMapping("/register")
    @HystrixCommand(fallbackMethod = "sorry")
    public Object register(RegisterParam registerParam){
        return helloService.register(registerParam);
    }*/



    /**
     * HystrixCommand  配置熔断返回方法
     * @return
     */
    @RequestMapping("/checkLogin")
    @HystrixCommand(fallbackMethod = "sorry")
    public Object checkLogin(String account,String password){
        return helloService.checkLogin(account,password);
    }


    public Object sorry(){
        return helloService.returnBaidu();
    }
}
